﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class MouseDrag : MonoBehaviour
{
    public float muliforce = 2.0f;
    Rigidbody2D rigidbody2d;
    private void Start()
    {
        rigidbody2d = GetComponent<Rigidbody2D>();
    }
    private void OnMouseDrag()
    {
        Vector3 mousepo = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        rigidbody2d.AddForce(muliforce*(mousepo-transform.position));
    }
}
